﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/TemplateUser.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="ManageBanking.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
  
    <script src="../../Scripts/smartpaginator.js" type="text/javascript"></script>

    <link href="../../Content/css/smartpaginator.css" rel="stylesheet" type="text/css" />
     <script src="../../Scripts/JTPS.js" type="text/javascript"></script>

    <link href="../../Content/css/SucErr1.css" rel="stylesheet" type="text/css" />

    <script src="../../Scripts/wysiwyg.js" type="text/javascript"></script>

    <script src="../../Scripts/functions.js" type="text/javascript"></script>

    <script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
  <script type="text/javascript">
      $(function() {
      $("#us1").autocomplete({
              source: '/Admin/ManageUserAdmin/CompleteUser',
              minLength: 1

          });
      });
</script>
	<script language="javascript" type="text/javascript">
	    $(document).ready(function() {

	        $('.f1').validate({
	            rules: {
	                money: {
	                    required: true,
	                    number: true

	                }
	            }, //ket thuc rules
	            messages: {
	                money: {
	                    required: "Money not null",
	                    number: "Money is number"

	                }

	            }
	        });  // ket thuc validate

	        $('#Text1').keyup(function() {
	            $('label.error').remove();
	            $('#Text1').removeClass("error");
	        });
	        var dem = 0;
	        $('input#ud1').click(function() {
	            $('label.error').remove();
	            
	        });
    
                            
    
	    });
	                 // ket thuc ready
    </script>
    
    <script language="javascript" type="text/javascript">
        $(document).ready(function() {
            var count = $('#Count').attr("value");
            var check = $('#Check').attr("value");
            var str;
            var im = 0;
            function hidden() {
                for (var i = 0; i < count; i++) {

                    $('#input' + i).hide();
                    $('#submit-' + i).hide();
                    $('#cancel-' + i).hide();
                    $("#" + i).show();
                }
            }

            hidden();
            $('.action').click(function() {
                var id = $(this).attr("id");
                str = $("#Select-" + id).find("option:selected");
                if (str.attr("value") != 3) {
                    hidden();


                    $("#" + id).hide();
                    $('#input' + id).show();
                   
                    $('.delerror').attr("value", "0");
                    $('#submit-' + id).show();

                    str = $('#input' + id).attr("value");
                     
                }

            });
            $('.submit').click(function() {

                var a = $(this).attr("id");
                var spilt2 = a.split('-');

                $("#" + spilt2[1]).show();
                $('#input' + spilt2[1]).hide();
                $('#submit-' + spilt2[1]).hide();
                check = 0;


            });

            $(".Select").change(function() {

                var c = $(this).attr("id");
                var spilt3 = c.split('-');
                var total = $("#total" + spilt3[1]).attr("value");
                str = $("#" + c).find("option:selected");

                if (str.attr("value") == 3) {
                    hidden();
                    $("#" + spilt3[1]).show();
                    $('#input' + spilt3[1]).hide();
                    $('#submit-' + spilt3[1]).show();
                    im = 1;

                    $('#input' + spilt3[1]).attr("readonly", "readonly");
                    $('#input' + spilt3[1]).attr("value", 100);

                }
                else {
                    $('#input' + spilt3[1]).hide();
                    $('#input' + spilt3[1]).removeAttr("readonly");
                    $('#submit-' + spilt3[1]).hide();
                    $('#input' + spilt3[1]).attr("value", str);
                    
                    $("#" + spilt3[1]).show();
                }
            });



        });
    </script>
    

    <link href="../../Content/css/screen.css" rel="stylesheet" type="text/css" />
 <%-- <link href="../../Areas/Admin/Content/css/screen.css" rel="stylesheet" type="text/css" />--%>
    <script type="text/javascript" language="javascript">

      $(document).ready(function() {
       
      $('#empTable').jTPS({clickCallback: function() {
              // target table selector
      var table = '#empTable';
              // store pagination + sort in cookie 
              document.cookie = 'jTPS=sortasc:' + $(table + ' .sortableHeader').index($(table + ' .sortAsc')) + ',' +
                                                'sortdesc:' + $(table + ' .sortableHeader').index($(table + ' .sortDesc')) + ';';
              $('tr.stubCell').remove();
          }
      });
          

          // reinstate sort and pagination if cookie exists
          var cookies = document.cookie.split(';');
          for (var ci = 0, cie = cookies.length; ci < cie; ci++) {
              var cookie = cookies[ci].split('=');
              if (cookie[0] == 'jTPS') {
                  var commands = cookie[1].split(',');
                  for (var cm = 0, cme = commands.length; cm < cme; cm++) {
                      var command = commands[cm].split(':');
                      if (command[0] == 'sortasc' && parseInt(command[1]) >= 0) {
                          $('#empTable .sortableHeader:eq(' + parseInt(command[1]) + ')').click();
                          $('tr.stubCell').remove();
                      } else if (command[0] == 'sortdesc' && parseInt(command[1]) >= 0) {
                      $('#empTable .sortableHeader:eq(' + parseInt(command[1]) + ')').click().click();
                      $('tr.stubCell').remove();
                      } 
                  }
              }
          } 

          // bind mouseover for each tbody row and change cell (td) hover style
          $('#empTable tbody tr:not(.stubCell)').bind('mouseover mouseout',
                                function(e) {
                                    // hilight the row
                                    e.type == 'mouseover' ? $(this).children('td').addClass('hilightRow') : $(this).children('td').removeClass('hilightRow');
                                }
                        );

      });

     
        </script>
        
    <script type="text/javascript">
        $(document).ready(function() {

            $("select#perpage").change(function() {
                var str;
                $("select option:selected").each(function() {
                    str = parseInt($(this).text());
                });


                $('#red').smartpaginator({ totalrecords: $('input#totaluser').attr('value'), recordsperpage: str, length: 4, datacontainer: 'empTable', dataelement: 'tr', next: 'Next', prev: 'Prev', first: 'First', last: 'Last', theme: 'black', controlsalways: true, onchange: function(newPage) {
                    $('#r').html('Page # ' + newPage);
                }
                });

                $('.short').remove();


            }).change();
        });
    </script>
    
      
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
   
      
      
        <%         
        List<decimal> money = (List<decimal>)ViewData["money"];
        List<InformationAccount> ac = (List<InformationAccount>)ViewData["info"];
        
        
         %>

         
         <%using (Html.BeginForm("ShowDep_With","Cashier")){ %>
         <div class="top_model"><h5>Username: </h5>
    <input id="us1" type="text" name="username" />
    
    <input id="show"  type="submit" value="show" />
    
    </div>
    <%} %>
     <% if (ViewData["Check"] == "true")
              {
                  %>
         <div class="succes">
					<div class="succes_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Success!</span>
						<p>Successfull,Your Action Is Successful</p>
					</div>
				</div>
				<div class="clear"><!-- --></div>   
				<%} %>
				<%else if (ViewData["Check"]!=null){ %>
				<div class="err">
					<div class="err_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Error!</span>
						<p><%=ViewData["Check"]%></p>
					</div>
				</div>
				<%} %>
      <input id="Count" type="hidden" value="<%=ac.Count %>"/>
      <input id="Check" type="hidden" value="0"/>
   <table id="empTable" class="empTable3 empTable1" border="0"  cellpadding="0" cellspacing="0" >
	 <thead>
	<tr>
		<th sort="index" align="center" class="table-header-account th-withdaw-dep-idaccount"><a>ID Account</a>	</th>
		
		<th sort="date" align="center" class="table-header-repeat line-left th-withdaw-dep-date"><a>Creation Date</a></th>
		<th sort="Total" class="table-header-repeat line-left th-withdaw-dep-balance"><a>Balance</a></th>
		<th class="table-header-repeat line-left th-withdaw-dep-transmoney"><a>TransMoney</a></th>
		<th sort="Total" class="table-header-repeat line-left th-withdaw-dep-type"><a>Type</a></th>
		<th sort="description" style="width: 83px;" class="table-header-options2 line-leftth-withdaw-dep-options"><a>Options</a></th>
	</tr>
	</thead>
	  <tbody>
	 
	<%  int dem = 1;
     for (int i = 0; i < ac.Count; i++)
     {%>
        
        
            
	            <tr class="alternate-row">
	            <%using (Html.BeginForm("ResolveWit_Dep", "Cashier", FormMethod.Post,new { @class = "f1" }))
          { %>
		            <td align="center" class="lock"><%=ac[i].IdAccount%></td>
		        
		            <td align="center"><%=ac[i].DateCreate.Value.ToString("yyyy-MM-dd")%></td>
		            <td align="center" class="lock">$
		             <%= money[i].ToString("#,## ;#.##0.00'-';0 ")%>
                     <input id='total<%=i %>' type="hidden" value="<%=money[i] %>" />       
                     <input id="Hidden2" type="hidden" name="totalmoney" value="<%=money[i] %>" />
                        <input id="Hidden3" type="hidden" name="idaccount" value="<%=ac[i].IdAccount %>" /> 
                        <%Username us = (Username)Session["Login"]; %>
                        
                        <input id="Hidden4" type="hidden" name="idadmin" value="<%=us.IdUsername %>" />
		            </td>
		            <td align="center" class="lock">
                    <label id='<%=i %>' class="action" >Click Input Money</label>
                    <input  id='input<%=i %>' style="width: 115px;" value="0"  type="text" class="delerror"  name="money" size="10px" />  
                        
                    
		            </td>
                    
		            <td align="center" class="lock">
		            <input id="Hidden1" type="hidden" name="id" value="<%=ViewData["id"] %>" />
                    <select id='select-<%=i %>'  class="Select" name="type">
		                    <option value="1">Deposit</option>
		                    <option value="2">Withdraw</option>
		                    <option value="3">Deactivate</option>
		                
		                </select> 
                     
		            </td>
		            
		            <td class="options-width">
                        <input id='submit-<%=i %>' type="submit"  value="" class="icon-1 submit filaden"  title="Update"/>
                                             
                        
		            </td>
	            </tr>
	        
	            
	<%  
        }
	     %>
	     <%} %>
	       </tbody>
	</table>
	<!--  end product-table................................... --> 
	

    <!--  start paging..................................................... -->
	<div id="red" style="margin: auto;">
	     <input id="totaluser" type="hidden" value='<%= ViewData["totaluser"]%>'  />
	</div>
	
	<div id="drop" >
	    <select id="perpage" >   
            <option value="2">2</option>
			<option selected="selected" value="5">5</option>
			<option value="10">10</option>
			<option value="15">15</option>
			<option value="20">20</option>
			<option value="30">30</option>
		</select>
	</div>
	<!--  end paging................ -->


</asp:Content>
